<template>
  <div>
    <header :style="{ background: one }" class="header">
      <i class="el-icon-s-unfold"></i>
      <span>设置</span>
    </header>
    <div class="main">
      <div class="mainbox">
        <h3>主题配色</h3>
        <div class="select">
          <div class="color">
            <svg
              xmlns="http://www.w3.org/2000/svg"
              xmlns:xlink="http://www.w3.org/1999/xlink"
              viewBox="0 0 650 650"
              preserveAspectRatio="xMidYMid meet"
              width="650"
              height="650"
              class="hide-nonaccents"
            >
              <defs>
                <filter id="drop-shadow">
                  <feGaussianBlur
                    in="SourceAlpha"
                    stdDeviation="3.2"
                  ></feGaussianBlur>
                  <feOffset dx="0" dy="0" result="offsetblur"></feOffset>
                  <feFlood flood-color="rgba(0,0,0,1)"></feFlood>
                  <feComposite in2="offsetblur" operator="in"></feComposite>
                  <feMerge>
                    <feMergeNode></feMergeNode>
                    <feMergeNode in="SourceGraphic"></feMergeNode>
                  </feMerge>
                </filter>
              </defs>
              <g class="wheel--maing" transform="translate(325,325)">
                <g
                  v-for="(item, index) in color"
                  :key="index"
                  data-color="teal"
                  id="teal"
                  :transform="item.rotate"
                  class=""
                  @click="SET_COLOR(index)"
                >
                  <g class="polygons" filter="">
                    <polygon
                      points="32.94244769737761,-94.41819284282845 82.35611924344403,-236.0454821070711 0,-250 0,-140"
                      :style="item.bgcol"
                    ></polygon>
                    <polygon
                      points="32.94244769737761,-94.41819284282845 46.11942677632865,-132.1854699799598 0,-140 0,-100"
                      :style="item.bgcol"
                    ></polygon>
                  </g>
                </g>
              </g>
            </svg>
          </div>
          <div class="yl">
            <h2 :style="{ background: one }">
              <i class="el-icon-s-unfold"></i>
              <span>主题预览</span>
              <i class="el-icon-zoom-in"></i>
            </h2>
          </div>
          <div class="cont">
            <h2>你好</h2>
            <p>这只是个栗子，不要多多在意，包括这些演示按钮也是假的！</p>
            <div class="btn">
              <el-button :style="{ background: two }" type="primary">
                好
              </el-button>
              <el-button :style="{ background: two }" type="primary">
                尚待改进
              </el-button>
              <el-button :style="{ background: two }" type="primary">
                辣鸡
              </el-button>
            </div>
            <div class="zan">
              <el-button
                :style="{ background: two }"
                type="primary"
                icon="el-icon-edit"
                circle
              ></el-button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState, mapActions } from 'vuex'
export default {
  computed: {
    ...mapState(['color', 'one', 'two']),
  },
  methods: {
    ...mapActions(['SET_COLOR']),
  },
}
</script>

<style lang="scss">
* {
  padding: 0;
  margin: 0;
}
.header {
  width: 100%;
  height: 64px;
  color: #000;
  line-height: 64px;
  font-size: 20px;
  i {
    margin: 0 20px;
  }
}
.main {
  width: 100%;
  position: relative;
  background: #eee;
  .mainbox {
    padding: 20px;
    margin: 0 auto;
    width: 768px;
    h3 {
      padding: 0 16px;
      font-weight: 500;
      height: 48px;
      font-size: 14px;
      line-height: 48px;
    }
    .select {
      background: #fff;
      div {
        margin: 0 auto;
      }
      .color {
        height: 450px;
        margin: 0 auto;
        width: 450px;
        svg {
          width: 100%;
          height: 100%;
          //selected使小角标显示
          .selected {
            .selector {
              opacity: 1;
            }
          }
          .selector {
            opacity: 0;
            transition: opacity 0.4s cubic-bezier(0.4, 0, 1, 1);
            fill: #bdbdbd;
          }
          .label {
            text-anchor: middle;
            opacity: 0;
            transition: opacity 0.4s cubic-bezier(0.4, 0, 1, 1);
            fill: #fff;
            font-size: 24px;
          }
          //   是相应数字显示
          .selected--1 .label--1,
          .selected--2 .label--2 {
            opacity: 1;
          }
        }
      }
      .yl {
        width: 716px;
        h2 {
          height: 64px;
          line-height: 64px;
          font-weight: 400;
          i {
            margin: 0 15px;
          }
          span ~ i {
            float: right;
            margin-top: 20px;
          }
        }
      }
      .cont {
        width: 682px;
        height: 450px;
        background: #eee;
        h2 {
          padding: 36px 0 18px 0;
          margin-left: 18px;
          font-weight: 400;
        }
        p {
          margin-left: 18px;
        }
        .btn {
          margin-top: 25px;
          margin-left: 25px;
          button {
            margin-right: 20px;
          }
        }
        .zan {
          margin-top: 30px;
          margin-right: 20px;
          button {
            float: right;
          }
        }
      }
    }
  }
}
</style>
